Jinga Templates - Django Web Development

by: dabaxt01, 8 years ago

Last edited: 8 years ago

Hi, I'm attempting to complete this tutorial using c9.io, which comes with an environment with Django pre-installed. I've reached the third part of the tutorial as evident by the name of my post.

I've gotten as far as creating mysite/personal/templates/personal/header.html
and personal/templates/personal/home.html

However, when I attempt to run my site I get:

TemplateDoesNotExist at /

Error during template rendering

In template /home/ubuntu/workspace/personal/templates/personal/home.html, error at line 1


{% extends "personal/header.html" %}
{% block content %}
<p> Yadda yadd yadda... </p>
{% endblock %}


I've tried home home.html to mysite/personal/templates/personal/header.html but end up with a similar error.



You must be logged in to post. Please login or register an account.



Interesting, I am not familiar with c9.io unfortunately, maybe they aren't fans of local paths.

Did the part where we did
def index(request):
    return render(request, 'personal/home.html')


work and return the page successfully?

-Harrison 8 years ago

You must be logged in to post. Please login or register an account.


Thanks for the reply!

I've switched to doing this tutorial in Ubuntu and am still running into the same error. I included the function in my view.py file like you stated in your reply. Also, I've created mysite/personal/templates/personal/home.html and also personal/templates/header.html

Is it possible I have my html files in the wrong places?

-dabaxt01 8 years ago

You must be logged in to post. Please login or register an account.


Yes, that's almost certainly the case.

Probably the c9.io paths are weird or something. Do you know the "full" path to your html file? Try to include the FULL path rather than the local maybe.

If Django is pre-installed, did it come with a templates directory already?

If Django is pre-installed, they might have changed a setting regarding where templates are stored.

-Harrison 8 years ago
Last edited 8 years ago

You must be logged in to post. Please login or register an account.